<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@include file="/WEB-INF/public/head.jsp" %>


<style>
    .ui-icon-seek-first::before{
        content:"<<";
    }
    .ui-icon-seek-prev::before{
        content:"<";

    }
    .ui-icon-seek-end::before{
        content:">>";

    }
    .ui-icon-seek-next::before{
        content:">";

    }
</style>

<%@include file="/WEB-INF/public/nav.jsp" %>

<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>


        <div class="sidebar" id="sidebar">
            <script type="text/javascript">
                try {
                    ace.settings.check('sidebar', 'fixed')
                } catch (e) {
                }
            </script>
            <%@include file="/WEB-INF/public/menu.jsp" %>


            <div class="sidebar-collapse" id="sidebar-collapse">
                <i class="icon-double-angle-left" data-icon1="icon-double-angle-left"
                   data-icon2="icon-double-angle-right"></i>
            </div>

            <script type="text/javascript">
                try {
                    ace.settings.check('sidebar', 'collapsed')
                } catch (e) {
                }
            </script>
        </div>

        <div class="main-content">
            <%@include file="/WEB-INF/public/breadcrumb.jsp" %>

            <div class="page-content">
                <div class="row">
                    <div class="cf col-xs-12 col-lg-6">
                        <a class="btn btn-danger btn-sm" href="javascript:;" onClick="return confirm('确定数据初始化么?');">数据初始化</a>
                        <a class="btn btn-danger btn-sm" onClick="oper.addbscj('bscj')">导入笔试成绩</a>
                        <a class="btn btn-danger btn-sm" onClick="oper.addmscj('mscj')">导入面试成绩</a>
                        <a class="btn btn-danger btn-sm" href="javascript:;">一键核算</a>
                        <a class="btn btn-danger btn-sm" href="javascript:;">一键录取</a>
                        <a class="btn btn-success btn-sm" href="javascript:;">录取结果</a>
                        <a class="btn btn-success btn-sm" href="/test/export">导出</a>
                    </div>
                    <table id="grid-table" style="background: #fff;"></table>
                    <div id="grid-pager"></div>

                    <div class="showModal"></div>
                    <div class="showInfo"></div>

                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div><!-- /.main-content -->

    </div><!-- /.main-container-inner -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>
<!-- /.main-container -->
<%@include file="/WEB-INF/public/footerjs.jsp" %>
<script src="/ace/js/jqGrid/i18n/grid.locale-cn.js"></script>
<script src="/ace/js/jqGrid/jquery.jqGrid.min.js"></script>
<script>
    var $jqGrid=$('#grid-table'),$pager=$('#grid-pager');
    $jqGrid.jqGrid({
        url:"${pageContext.request.contextPath}/test/getData",
        datatype:'json',
        mttype:'post',
        height:'auto',
        colNames:['录取状态','考生号','姓名','身份证号','语文成绩','数学成绩','外语成绩','面试成绩','政策加分','总成绩','地域排名','服务县区','志愿','操作'],
//        colNames:['考生号','姓名','身份证号'],
        colModel:[
            {name:'sflq',index:'sflq',width:'100',align:'center',formatter:function(cellvalue,options,rowObject){
            var res='';
            switch(cellvalue){
                case 0:
                    res='数据初始化';
                    break;
                case 1:
                    res='导入笔试成绩';
                    break;

            }
            return res;
            }},
            {name:'ksh',index:'ksh',width:'100',align:'center'},
            {name:'xm',index:'xm',width:'100',align:'center'},
            {name:'sfzh',index:'sfzh',width:'100',align:'center'},
            {name:'ywcj',index:'ywcj',width:'100',align:'center'},
            {name:'sxcj',index:'sxcj',width:'100',align:'center'},
            {name:'wycj',index:'wycj',width:'100',align:'center'},
            {name:'mscj',index:'mscj',width:'100',align:'center'},
            {name:'zcjf',index:'zcjf',width:'100',align:'center'},
            {name:'zcj',index:'zcj',width:'100',align:'center'},
            {name:'fdqpm',index:'fdqpm',width:'100',align:'center'},
            {name:'fwxq',index:'fwxq',width:'100',align:'center'},
            {name:'kszy1',index:'kszy1',width:'100',align:'center'},
            {name:'ksh',index:'ksh',width:'100',align:'center',formatter:function(cellvalue,options,rowObject){
//            console.log(cellvalue);
//            console.log(rowObject);
            return '<a class="btn btn-info btn-xs" onclick="showInfoBtn(\''+cellvalue+'\')">查看详情</a>';
            }}
        ],
        rowNum:10,
        rowList:[10,20,30],
        pager: '#grid-pager',
        viewrecords: true
//        jsonReader:{
//            id:"blackId",
//            repeatitems:false
//        }

    });
    $jqGrid.jqGrid('navGrid', '#grid-pager', {edit : false,add : false,del : false});


    function showInfoBtn(id){
        console.log(id);
        $.ajax({
            type: "POST",
            url: "showInfo",
            data: {
                ksh: id,
            },
            dataType: "html",
            success: function(data) {
                console.log(data);
                $('.showInfo').html(data);
                $('#ModalInfo').modal();

            }
        });
    }

    oper={
        addbscj:function(){
            $.ajax({
                type: "POST",
                url: "addbscj",
                data: {
                    flag: this.flag,
                },
                dataType: "html",
                success: function(data) {
                    if (data == '1') {
                        alert("请确认录取状态是否正确");
                    } else {
                        $('.showModal').html(data);
                        $('#myModal').modal();
                        $('#id-input-file-2').ace_file_input({
                            no_file: '请选择文件 ...',
                            btn_choose: '选择',
                            btn_change: '修改',
                            droppable: false,
                            onchange: null,
                            thumbnail: false //| true | large

                        });
                    }


                }
            });
        }
    }
</script>
<%@include file="/WEB-INF/public/foot.jsp" %>
